import axios from 'axios'
import { GET_INDEX_LOOPIMG,GET_PROMOTION_PRODUCT } from '../actionTypes'

const getIndexLoopImgAction = () => {
    return (dispatch) => {
        axios.get('http://s.linweiqin.com/api/s/getIndexLoopimg').then((res) => {   
            dispatch({
                type: GET_INDEX_LOOPIMG,
                payload: {
                    swiperList: res.data.wdata
                }
            })
        })
    }
}

const getIndexPromotionListAction = () => {
    return (dispatch) => {
        axios.get('http://s.linweiqin.com/api/s/getProducts').then((res) => {
            dispatch({
                type:GET_PROMOTION_PRODUCT,
                payload:{
                    promotionList:res.data.wdata
                }
            })
        }
        )
    }
}


export { getIndexLoopImgAction,getIndexPromotionListAction };